﻿using UnityEngine;
using UnityEngine.Events;

namespace Entity
{
    public class PlayerDeath : MonoBehaviour
    {
        [SerializeField] private UnityEvent died;

        public void CheckDeath(int health)
        {
            if (health <= 0)
                Die();
        }
    
        public void Die()
        {
            gameObject.SetActive(false);
            died.Invoke();
        }
    }
}